<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of showinfowindow</title>
  <meta name="keywords" content="showinfowindow">
  <meta name="description" content="SHOWINFOWINDOW creates a small dialog window which displays a user-defined message.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">code</a> &gt; showinfowindow.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for code&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>showinfowindow
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>SHOWINFOWINDOW creates a small dialog window which displays a user-defined message.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function f = showinfowindow(msg,wtitle,handleDispGUI) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> SHOWINFOWINDOW creates a small dialog window which displays a user-defined message. 

 Syntax:

 showinfowindow
 h = showinfowindow
 showinfowindow(msg)
 h = showinfowindow(msg)
 showinfowindow(msg,wtitle)
 h = showinfowindow(msg,wtitle)

 showinfowindow and h = showinfowindow without any input arguments create an example.
 
 showinfowindow(msg) and h = showinfowindow(msg) display the user-defined message msg
 which should be a character string or a cell array of strings.

 showinfowindow(msg,wtitle) and h = showinfowindow(msg,wtitle) display the user-defined 
 message msg which should be a character string or a cell array of strings. This time the
 window has the title wtitle

 Examples

 h1 = showinfowindow('Running - Please wait...');
 
 h2 = showinfowindow({'This is a long message for a long process.',...
                      'It is displayed in two lines.'},'Long message');

==========================================================

 Author        : Panagiotis Moulos (pmoulos@eie.gr)
 First created : May 7, 2007
 Last modified : June 11, 2007</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="das_gui.html" class="code" title="function varargout = das_gui(varargin)">das_gui</a>	DAS_GUI main GUI of DASMiner Browser</li><li><a href="queryFeatures.html" class="code" title="function queryFeatures(hObject,handles)">queryFeatures</a>	QUERYFEATURES used by DASMiner Browser for managing a DAS feature query</li><li><a href="searchRegistry_gui.html" class="code" title="function varargout = searchRegistry_gui(varargin)">searchRegistry_gui</a>	SEARCHREGISTRY_GUI is the GUI for DAS Registry search in Browser</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function f = showinfowindow(msg,wtitle,handleDispGUI)</a>
0002 <span class="comment">% SHOWINFOWINDOW creates a small dialog window which displays a user-defined message.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% Syntax:</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% showinfowindow</span>
0007 <span class="comment">% h = showinfowindow</span>
0008 <span class="comment">% showinfowindow(msg)</span>
0009 <span class="comment">% h = showinfowindow(msg)</span>
0010 <span class="comment">% showinfowindow(msg,wtitle)</span>
0011 <span class="comment">% h = showinfowindow(msg,wtitle)</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% showinfowindow and h = showinfowindow without any input arguments create an example.</span>
0014 <span class="comment">%</span>
0015 <span class="comment">% showinfowindow(msg) and h = showinfowindow(msg) display the user-defined message msg</span>
0016 <span class="comment">% which should be a character string or a cell array of strings.</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% showinfowindow(msg,wtitle) and h = showinfowindow(msg,wtitle) display the user-defined</span>
0019 <span class="comment">% message msg which should be a character string or a cell array of strings. This time the</span>
0020 <span class="comment">% window has the title wtitle</span>
0021 <span class="comment">%</span>
0022 <span class="comment">% Examples</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% h1 = showinfowindow('Running - Please wait...');</span>
0025 <span class="comment">%</span>
0026 <span class="comment">% h2 = showinfowindow({'This is a long message for a long process.',...</span>
0027 <span class="comment">%                      'It is displayed in two lines.'},'Long message');</span>
0028 <span class="comment">%</span>
0029 <span class="comment">%==========================================================</span>
0030 <span class="comment">%</span>
0031 <span class="comment">% Author        : Panagiotis Moulos (pmoulos@eie.gr)</span>
0032 <span class="comment">% First created : May 7, 2007</span>
0033 <span class="comment">% Last modified : June 11, 2007</span>
0034 <span class="comment">%</span>
0035 
0036 <span class="comment">% Check input arguments</span>
0037 <span class="keyword">if</span> nargin&lt;1
0038     msg=<span class="string">'Example of showinfowindow.m'</span>;
0039     wtitle=<span class="string">'Example'</span>;
0040 <span class="keyword">elseif</span> nargin&lt;2
0041     wtitle=<span class="string">'Info'</span>;
0042 <span class="keyword">end</span>
0043 <span class="keyword">if</span> ~iscell(msg)
0044     msg={msg};
0045 <span class="keyword">end</span>
0046 
0047 <span class="comment">% Set default sizes</span>
0048 DefFigPos=get(0,<span class="string">'DefaultFigurePosition'</span>);
0049 MsgOff=7;
0050 FigWidth=200;
0051 FigHeight=50;
0052 DefFigPos(3:4)=[FigWidth FigHeight];
0053 MsgTxtWidth=FigWidth-2*MsgOff;
0054 MsgTxtHeight=FigHeight-2*MsgOff;
0055 
0056 <span class="comment">% Initialize dialog window</span>
0057 f=dialog(<span class="string">'Name'</span>,wtitle,<span class="string">'Units'</span>,<span class="string">'points'</span>,<span class="string">'WindowStyle'</span>,<span class="string">'normal'</span>,<span class="string">'Toolbar'</span>,<span class="string">'none'</span>,<span class="keyword">...</span>
0058          <span class="string">'DockControls'</span>,<span class="string">'off'</span>,<span class="string">'MenuBar'</span>,<span class="string">'none'</span>,<span class="string">'Resize'</span>,<span class="string">'off'</span>,<span class="string">'ToolBar'</span>,<span class="string">'none'</span>,<span class="keyword">...</span>
0059          <span class="string">'NumberTitle'</span>,<span class="string">'off'</span>,<span class="string">'CloseRequestFcn'</span>,<span class="string">'closereq'</span>);
0060 
0061 <span class="comment">% Initialize message</span>
0062 msgPos=[MsgOff MsgOff MsgTxtWidth MsgTxtHeight];
0063 msgH=uicontrol(f,<span class="string">'Style'</span>,<span class="string">'text'</span>,<span class="string">'Units'</span>,<span class="string">'points'</span>,<span class="string">'Position'</span>,msgPos,<span class="string">'String'</span>,<span class="string">' '</span>,<span class="keyword">...</span>
0064                <span class="string">'Tag'</span>,<span class="string">'MessageBox'</span>,<span class="string">'HorizontalAlignment'</span>,<span class="string">'left'</span>,<span class="string">'FontSize'</span>,8);
0065 [WrapString,NewMsgTxtPos]=textwrap(msgH,msg,75);
0066 set(msgH,<span class="string">'String'</span>,WrapString)
0067 delete(msgH);
0068 
0069 <span class="comment">% Fix final message positions</span>
0070 MsgTxtWidth=max(MsgTxtWidth,NewMsgTxtPos(3));
0071 MsgTxtHeight=min(MsgTxtHeight,NewMsgTxtPos(4));
0072 MsgTxtXOffset=MsgOff;
0073 MsgTxtYOffset=MsgOff;
0074 FigWidth=MsgTxtWidth+2*MsgOff;
0075 FigHeight=MsgTxtYOffset+MsgTxtHeight+MsgOff;
0076 
0077 DefFigPos(3:4)=[FigWidth FigHeight];
0078 set(f,<span class="string">'Position'</span>,DefFigPos);
0079 
0080 <span class="comment">% Create the message</span>
0081 AxesHandle=axes(<span class="string">'Parent'</span>,f,<span class="string">'Position'</span>,[0 0 1 1],<span class="string">'Visible'</span>,<span class="string">'off'</span>);
0082 txtPos=[MsgTxtXOffset MsgTxtYOffset 0];
0083 text(<span class="string">'Parent'</span>,AxesHandle,<span class="string">'Units'</span>,<span class="string">'points'</span>,<span class="string">'HorizontalAlignment'</span>,<span class="string">'left'</span>,<span class="keyword">...</span>
0084      <span class="string">'VerticalAlignment'</span>,<span class="string">'bottom'</span>,<span class="string">'Position'</span>,txtPos,<span class="string">'String'</span>,WrapString,<span class="keyword">...</span>
0085      <span class="string">'FontSize'</span>,8,<span class="string">'Tag'</span>,<span class="string">'MessageBox'</span>);
0086  
0087 <span class="comment">% Move the window to the center of the defined display (handleDispGUI)</span>
0088 set(f,<span class="string">'Units'</span>,<span class="string">'pixels'</span>);
0089 screensize=get(0,<span class="string">'screensize'</span>);                       
0090 <span class="comment">% winsize=get(f,'Position');</span>
0091 currentFig = get(0,<span class="string">'CurrentFigure'</span>);
0092 winsize = get(currentFig,<span class="string">'Position'</span>);
0093 winwidth=winsize(3);
0094 winheight=winsize(4);
0095 screenwidth=screensize(3);                           
0096 screenheight=screensize(4);                           
0097 winpos=[0.5*(screenwidth-winwidth),0.5*(screenheight-winheight),winwidth,winheight];                          
0098 set(f,<span class="string">'Position'</span>,winpos);
0099 
0100 <span class="comment">% Give priority to displaying this message</span>
0101 drawnow</pre></div>
<hr><address>Generated on Tue 17-Feb-2009 16:59:45 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>